package com.ray.quartz.common;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ray.api.service.UcenterApiService;
import com.zjhc.flyhong.common.datastructure.TreeNode;
import com.zjhc.flyhong.common.function.operator.LoginUser;
import com.zjhc.flyhong.common.web.Result;
import com.zjhc.web.controller.WebController;

/**
 * <h1>通用树 控制器</h1>
 * 
 * @创建人 ray
 * @创建时间 2017-06-12
 * @版本 1.0
 * @重要修改备注
 * 
 */
@Controller
@RequestMapping("/treeController")
public class TreeController extends WebController{
	
 @Autowired
 UcenterApiService ucenterApiService;

/**
* 组织异步树
* @return
*/
@RequestMapping(value = "orgTree")
@ResponseBody
public ResponseEntity<List<TreeNode>> orgTree(String id,Integer level){
	LoginUser loginUser = getLoginUser();
	Result<List<TreeNode>> treeListResult = ucenterApiService.queryOrgListByParentId(id, level, loginUser);
	if(treeListResult.codeSuccess()){
	  return doSuccess(treeListResult.getData());
	}
	return  doError(treeListResult.getData());
}

}
